<?php

namespace app\common\controller;

use think\facade\Config;
use think\facade\Request;
use think\facade\Db;

class AppCommon{

    public function __construct() {	
		self::setSystemDefine(); //设置系统常量
        if (!file_exists(BASE_PATH . '../config/install.lock')) {
            header("location:/install/");
            exit;
        }
    }
	
    /**
     * 获取当前访问的模块及控制器
     * @author lijia
     * @date 2048-03-17
     */
    static function setSystemDefine() {
		define("CONTROLLER",Request::controller(true));
		define("ACTION",Request::action(true));
		define("SYS_PATH", config("admin.adminPath")?config("admin.adminPath"):"admin");
        define("SYS_PATH_AGENT", config("agent.adminPath")?config("agent.adminPath"):"agent");
    }
    /**
     * 获取Agent访问的模块及控制器
     * @author lijia
     * @date 2048-03-17
     */
    static function setSystemDefineAgent() {
        define("SYS_PATH_AGENT", config("agent.agentPath")?config("agent.agentPath"):"agent");
    }

}
